package com.xx.sg.controller;

import com.xx.sg.own.entity.AirLine;
import com.xx.sg.own.service.AirLineService;
import com.xx.sg.own.service.CheckPointService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/airLine")
@Tag(name = "航线管理", description = "航线管理API")
public class AirLineController {

    @Autowired
    private AirLineService airLineService;


    @GetMapping("/list")
    @Operation(summary = "获取航线列表", description = "获取航线列表")
    public Map list(@ModelAttribute AirLine airLine) {
        List<AirLine> list = airLineService.selectAirLineList(airLine);
        Map<String, Object> res = new HashMap<>();
        res.put("success", true);
        res.put("code", 200);
        res.put("message", "成功");
        res.put("data", list);
        return res;
    }


    @GetMapping("/info/{id}")
    @Operation(summary = "获取航线详情", description = "获取航线详情")
    public Map info(@PathVariable String id) {
        AirLine airLine = airLineService.selectAirLineById(id);
        Map<String, Object> res = new HashMap<>();
        res.put("success", true);
        res.put("code", 200);
        res.put("message", "成功");
        res.put("data", airLine);
        return res;
    }
}
